﻿// DigitalDesign
// Project: InformationBoard
// Developer: Montak Oleg
// Created: 14.11.2011
// Last change: 16.11.2011
// Description: wrapper-classes for transfer to an entity on the client

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Server
{
    [DataContract]
    public class wActualScheduleNode
    {
        #region constructors
        public wActualScheduleNode()
        {
            Location = new wLocation();
        }

        public wActualScheduleNode(Schedule scheduleNode, DateTime date)
        {
            Location = new wLocation(scheduleNode.Location);
            NumberOfTransport = scheduleNode.NumberOfTransport;
            StationOfDestination = scheduleNode.StationOfDestination;
            TimeOfDeparture = date.Date.Add(scheduleNode.TimeOfDeparture);
            TimeOfLanding = date.Date.Add(scheduleNode.TimeOfLanding);
            IsFromChanged = false;
        }

        public wActualScheduleNode(ScheduleChanx changeNode, DateTime date)
        {
            Location = new wLocation(changeNode.Location);
            NumberOfTransport = changeNode.NumberOfTransport;
            StationOfDestination = changeNode.StationOfDestination;
            TimeOfDeparture = date.Date.Add(changeNode.TimeOfDeparture);
            TimeOfLanding = date.Date.Add(changeNode.TimeOfLanding);
            IsFromChanged = true;
        }
        #endregion

        #region data members
        [DataMember]
        public int Id { get; set; }

        [DataMember]
        public DateTime TimeOfDeparture { get; set; }

        [DataMember]
        public DateTime TimeOfLanding { get; set; }

        [DataMember]
        public string StationOfDestination { get; set; }

        [DataMember]
        public string NumberOfTransport { get; set; }

        [DataMember]
        public bool IsFromChanged { get; set; } // ходит не постоянно, появился здесь из-за оперативных изменений

        [DataMember]
        public wLocation Location { get; set; }
        #endregion
    }
}
